var entityCollection = require('../../../Base/server/controllers/EntityCollection'),	
    PeriodOutputController = require('../../../Report/server/controllers/PeriodOutput.server.controller'),
    WorkOutputController = require('../../../Report/server/controllers/WorkOutput.server.controller'),
	BizRecordController = require('../../../Barcode/server/controllers/BizRecord.server.controller.js'),
	RcvRecordController = require('../../../ProduceWork/server/controllers/RcvRecord.server.controller.js'),
	DeliveryRecordController = require('../../../ProduceWork/server/controllers/DeliveryRecord.server.controller.js');

module.exports = function(app) {
	var entity = entityCollection.getEntity("BizRecord");
	entity.addEventListener("Inserted", function(){
		PeriodOutputController.createByBizRecord(this._id);
	    WorkOutputController.createByBizRecord(this._id);
	});

	entity = entityCollection.getEntity("RcvRecord");
	entity.addEventListener("Inserted", function(){
	    PeriodOutputController.createByRcvRecord(this._id);
	});

	entity = entityCollection.getEntity("DeliveryRecord");
	entity.addEventListener("Inserted", function(){
	    PeriodOutputController.createByDeliveryRecord(this._id);
	});
};